<extend name="work/base"/>
<block name="content">
    <header class="wx-header">
        <h1 class="wx-title">考勤签到</h1>
    </header>







</block>
<block name="script">
    <script src="__PUBLIC__/js/doT.min.js"></script>

    <script type="text/javascript">


        $(document).ready(function () {
            $(document.body).infinite();
            var loading = false;  //状态标记
            var limit = 1;
            var newlist = doT.template($('#listtmpl').html());
             updatelist();
            $(document.body).infinite().on("infinite", function () {
                 updatelist();
            });

            function updatelist() {
                if (loading) return;
                loading = true;
                $.ajax({
                    type: 'get',
                    dataType: "json",
                    url: '{:url("lists")}',
                    data: {page: limit},
                    success: function (res) {
                        if (res.code === 0) {
                            $("#order_list").append(newlist(res));
                            limit+=1;
                        } else {
                            $.toast(res.msg, "cancel");
                            $(".weui-loadmore").hide();
                            $(document.body).destroyInfinite();
                        }
                        loading = false;
                    },
                    error: function () {
                        $.toast('发生错误,请检测网络', "cancel");
                        loading = false;
                    },

                });
            }
            $("#order_list").on('click','.diamond_info',function () {
                var  param = 'id=' +$(this).attr('info_id')  ;
                location.href='{:url("info")}'+'?'+param
            });

        });
    </script>
</block>
